import { defineStore } from 'pinia';
export const useAiChatStore = defineStore("chat", {
    state: () => ({
        chatList:[
            {
                title: '默认问答',
                content:'你好，欢迎使用南邮智能客服~',
                time:'15:06',
                id: 1,
                type:'smartRobot',
                history:[]
            },
        ],
        activeChatId:1
    }),
    actions: {
        addChat(message) {
            this.chatList.splice(1, 0, message);
            // this.chatList.push(message);
        },
        deleteChat(message){
            this.chatList = this.chatList.filter(item=>item.id!==message.id)
        },
        changeActiveChatId(activeChatId) {
            this.activeChatId = activeChatId;
        }

    },
    persist: true
});